""" URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
# from django.contrib import admin
from rest_framework.routers import DefaultRouter

from . import views
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    # url(r'^admin/', admin.site.urls),

    # 判断用户名是否重复url
    url(r'^usernames/(?P<username>\w{5,20})/count/$', views.UsernameCountView.as_view()),

    # 判断手机号是否重复url
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),

    # 注册
    url(r'^users/$', views.UserView.as_view()),

    # # 验证JWT
    # url(r'^api-token-auth/', obtain_jwt_token),

    # 登录
    url(r'^authorizations/$', obtain_jwt_token),

    # 用户中心用户详情
    url(r'^user/$', views.UserDetailView.as_view()),

    # 设置邮箱
    url(r'^email/$', views.EmailView.as_view()),

    # 验证邮箱
    url(r'emails/verification/$', views.VerifyEmailView.as_view()),

    # 用户浏览历史记录
    url(r'^browse_histories/$', views.UserBrowsingHistoryView.as_view())
]

router = DefaultRouter()
router.register(r'addresses', views.AddressViewSet, base_name='addresses')
urlpatterns += router.urls
